﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.RRSModes.CUIRrsModesForm
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.RRSModes;

public class CUIRrsModesForm : TxForm
{
  private IContainer components;
  private GroupBox groupBox1;
  private RadioButton radioButton3;
  private RadioButton radioButton2;
  private RadioButton radioButton1;
  private Button button1;

  public CUIRrsModesForm()
  {
    this.InitializeComponent();
    this.Init();
  }

  private void Init()
  {
    if (!TxFeatureManager.CheckFeature("RRS_RECORDER"))
    {
      this.radioButton1.Checked = true;
      this.radioButton2.Enabled = false;
      this.radioButton3.Enabled = false;
    }
    else
    {
      switch (TxApplication.Options.Units.LinearDigitsAfterDecimalPoint)
      {
        case 8:
          this.radioButton2.Checked = true;
          break;
        case 9:
          this.radioButton3.Checked = true;
          break;
        default:
          this.radioButton1.Checked = true;
          break;
      }
    }
  }

  private void UpdateMode()
  {
    if (this.radioButton2.Checked)
      TxApplication.Options.Units.LinearDigitsAfterDecimalPoint = 8;
    else if (this.radioButton3.Checked)
      TxApplication.Options.Units.LinearDigitsAfterDecimalPoint = 9;
    else
      TxApplication.Options.Units.LinearDigitsAfterDecimalPoint = 7;
  }

  private void OnClose(object sender, EventArgs e) => ((Form) this).Close();

  private void radioButton1_CheckedChanged(object sender, EventArgs e) => this.UpdateMode();

  private void radioButton2_CheckedChanged(object sender, EventArgs e) => this.UpdateMode();

  private void radioButton3_CheckedChanged(object sender, EventArgs e) => this.UpdateMode();

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    this.groupBox1 = new GroupBox();
    this.radioButton3 = new RadioButton();
    this.radioButton2 = new RadioButton();
    this.radioButton1 = new RadioButton();
    this.button1 = new Button();
    this.groupBox1.SuspendLayout();
    ((Control) this).SuspendLayout();
    this.groupBox1.Controls.Add((Control) this.radioButton3);
    this.groupBox1.Controls.Add((Control) this.radioButton2);
    this.groupBox1.Controls.Add((Control) this.radioButton1);
    this.groupBox1.Location = new Point(12, 12);
    this.groupBox1.Name = "groupBox1";
    this.groupBox1.Size = new Size(140, 100);
    this.groupBox1.TabIndex = 0;
    this.groupBox1.TabStop = false;
    this.groupBox1.Text = "Select RRS Mode:";
    this.radioButton3.AutoSize = true;
    this.radioButton3.Location = new Point(7, 68);
    this.radioButton3.Name = "radioButton3";
    this.radioButton3.Size = new Size(72, 17);
    this.radioButton3.TabIndex = 2;
    this.radioButton3.TabStop = true;
    this.radioButton3.Text = "Recorded";
    this.radioButton3.UseVisualStyleBackColor = true;
    this.radioButton3.CheckedChanged += new EventHandler(this.radioButton3_CheckedChanged);
    this.radioButton2.AutoSize = true;
    this.radioButton2.Location = new Point(7, 44);
    this.radioButton2.Name = "radioButton2";
    this.radioButton2.Size = new Size(74, 17);
    this.radioButton2.TabIndex = 1;
    this.radioButton2.TabStop = true;
    this.radioButton2.Text = "Recording";
    this.radioButton2.UseVisualStyleBackColor = true;
    this.radioButton2.CheckedChanged += new EventHandler(this.radioButton2_CheckedChanged);
    this.radioButton1.AutoSize = true;
    this.radioButton1.Location = new Point(7, 20);
    this.radioButton1.Name = "radioButton1";
    this.radioButton1.Size = new Size(62, 17);
    this.radioButton1.TabIndex = 0;
    this.radioButton1.TabStop = true;
    this.radioButton1.Text = "Regular";
    this.radioButton1.UseVisualStyleBackColor = true;
    this.radioButton1.CheckedChanged += new EventHandler(this.radioButton1_CheckedChanged);
    this.button1.Location = new Point(77, 118);
    this.button1.Name = "button1";
    this.button1.Size = new Size(75, 23);
    this.button1.TabIndex = 1;
    this.button1.Text = "Close";
    this.button1.UseVisualStyleBackColor = true;
    this.button1.Click += new EventHandler(this.OnClose);
    ((ContainerControl) this).AutoScaleDimensions = new SizeF(6f, 13f);
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Form) this).ClientSize = new Size(164, 147);
    ((Control) this).Controls.Add((Control) this.button1);
    ((Control) this).Controls.Add((Control) this.groupBox1);
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUIRrsModesForm);
    ((Form) this).ShowIcon = false;
    ((Control) this).Text = "RRS Modes";
    this.groupBox1.ResumeLayout(false);
    this.groupBox1.PerformLayout();
    ((Control) this).ResumeLayout(false);
  }
}
